/*
 * vm_memory also use a list to store the elements which are free and used.
 * this file include the sturct of vm_struct and many other way to control
 * them.
 */

/*
  memory struct is a simple struct,it only contain the flag,start addr,size,and the next
  struct's addr.it just a list.
 */
struct vm_struct
{
	unsigned long flag;
	void  *addr;
	unsigned long size;
	struct vm_struct *next;
};

struct vm_struct *free_list_head,*free_list_tail;
struct vm_struct *used_list_head,*used_list_tail;


#define __add_to_free_list(a)({\
		free_list_tail->next=a;\
		free_list_tail=a;\
		})
#define __add_to_used_list(a)({ \
		used_list_tail->next=a;\
		used_list_tail=a;\
		})

#define __add_to_list(a,b) ({\
		if(a==0) __add_to_free_list(b);\
		if(a==1) __add_to_used_list(b);\
		})
/*
 * check if the vm is already in the list
 */
static int check_vm_memory(struct vm_struct *vm)
{
	 struct vm_struct *p=free_list_head;
	 struct vm_struct *q=p;
}
static void add_to_free_list(struct vm_struct *a)
{
	__add_to_free_list(a);
}
static void add_to_used_list(struct vm_struct *a)
{
	__add_to_used_list(a);
}
/*
  it is suck
 */
